package com.zhouyu.gamecommunity.service.impl;

import com.zhouyu.gamecommunity.dao.MessageMapper;
import com.zhouyu.gamecommunity.entity.Message;
import com.zhouyu.gamecommunity.entity.PageData;
import com.zhouyu.gamecommunity.entity.Result;
import com.zhouyu.gamecommunity.service.MessageService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description message
 * @author zhouyu
 * @date 2025-06-11
 */
@Service
public class MessageServiceImpl implements MessageService {

	@Resource
	private MessageMapper messageMapper;


	@Override
	public Result<PageData<Message>> getMessageList(String type, int page) {
		List<Message> messageList = messageMapper.pageList(type,page, 5);
		PageData<Message> pageData = new PageData<>();
		pageData.setList(messageList);
		pageData.setTotal(messageMapper.pageListCount(type));
		pageData.setPageNum(page);
		pageData.setPageSize(5);
		return Result.success(pageData);
	}
}